REM Example code for generating Director menus
REM Title:      3rdParty.Pludlam.Resources.Example
REM Author:     Philip Ludlam
REM Version:    0.03, Monday the 14th of January, 2002
REM Copyright:  (C) Philip Ludlam 2002

REM The example code is intended to be used to aid the generation of
REM Director menus.
REM You are free to licence that code any way you see fit.
REM Please remove this explanatory text and the copyright message above
REM from your code.



REM <description>
REM Title:      <filename>
REM Author:     <author>
REM Version:    <version>, <date>
REM Copyright:  <copyright>

REM <licence>

ON ERROR PROCerror

REM Define variables

DIM block% 1023

Menu=FNswi_number("Director_Menu")
EndMenu=FNswi_number("Director_EndMenu")
Option=FNswi_number("Director_Option")
Command=FNswi_number("Director_Command")
Dash=FNswi_number("Director_Dash")

REM Get command line

SYS "OS_GetEnv" TO comm%
SYS "OS_ReadArgs","name,quit,",comm%,block%,1023

REM Code

END

:

DEF FNswi_number(n$)
SYS "OS_SWINumberFromString",,n$ TO a%
=a%

:

DEF FNstring(p%):LOCAL a$:a$=""
WHILE ?p%>31
  a$+=CHR$(?p%):p%+=1
  ENDWHILE:=a$

:

REM want% = to what object type you want to find/are looking for
DEF FNfile_valid(file$,want%):LOCAL ans%
SYS "XOS_File",17,file$ TO ans%
=(ans%=want%)

:

DEF PROCerror
ON ERROR OFF
VDU 4
PRINT "Error in: <filename>"
PRINT "Report:   ";REPORT$
PRINT "Line:     ";ERL
END
